<template>
	<view class="content">
		<view class="login-box">
			<view class="login-reg">
				<!-- 注册 -->
				<view class="swiper-item  login">
					<view class="forms">
						<view class="icon-box flex">
							<text>手机号</text>
						</view>
						<view class="form-item">
							<input type="number" class="form-txt" placeholder-class="pla" placeholder="请输入手机号" v-model="form.mobile">
						</view>
						<view class="icon-box flex">
							<text>新密码</text>
						</view>
						<view class="form-item">
							<input type="text" password  class="form-txt" placeholder-class="pla" placeholder="请输入新密码" v-model="form.password">
						</view>
						<view class="icon-box flex">
							<text>确认新密码</text>
						</view>
						<view class="form-item">
							<input type="text" password  class="form-txt" placeholder-class="pla" placeholder="请确认新密码" v-model="form.repassword">
						</view>
						<view class="icon-box flex">
							<text>短信验证码</text>
						</view>
						<view class="form-item code flex-bt">
							<input type="number" class="form-txt" maxlength="6" placeholder-class="pla" placeholder="请输入短信验证码" v-model="form.vcode">
							<view class="btnget flex" :class="{ active: verCode.isDownIng || !form.mobile }" @tap="$u.throttle(getCode, 1000)">{{ verCode.text }}</view>
						</view>
					</view>
				</view>
 
			</view>

			<view class="container" style="margin-top: 36rpx;">

				<view class="btnbox common">
					<button class="com-btn flex-ct bg-red" :loading="isSubmit" @tap="login()">提交</button>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
		mapGetters
	} from 'vuex';
	import config from '@/common/config.js';
	import storge from '@/common/storge.js';
	import {password} from '@/config/user/api.js';
	export default {
		data() {
			return {
				loading: true,
				verCode: config.verCode,
				checked: false,
				form: {
					mobile: '',
					vcode: '',
					repassword:'',
					password:'',
				},
				isSubmit: false,
			}
		},
		components: {},
		onLoad() {


		},
		onShow() {},
		computed: {
			...mapState({
				userInfo: 'userInfo',
				addressMsg: 'addressMsg',
				nowHospital: 'nowHospital',
			})
		},
		methods: {
			getCode() {
				this.$common.getCode(this,3);
			},
			async login() {
				const that = this;
				that.isSubmit = true;
				const res = await password(that.form);
				that.isSubmit = false;
				if (res.state != 200) {
					this.$common.showTip(res.msg, 'none')
					return
				};
				that.$common.showTip('修改密码成功', 'none');
				setTimeout(()=>{
					that.$common.goback();
				},1000);
			},
			// 跳转页面方法
			toUrl(url) {
				uni.navigateTo({
					url
				})
			},
			...mapMutations(['setUserInfo', 'setAddressMsg', 'setNowHospital'])
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		position: relative
	}
	.tips{
		margin-top: 40rpx;
		font-size: 30rpx;
		text{
			font-weight: bold;
		}
	}
	.top-box{
		background: $red;
		color: #fff;
		font-size: 16px;
		font-weight: 600;
		padding: 40rpx 0 100rpx 0;
		.logo{
			width: 110rpx;
			margin-bottom: 40rpx;
		}
	}
	.img {
		position: fixed;
		width: 100vh;
		height: 100vh;
		top: 0;
		left: 0;
	}

	.icon-box {
		margin-top: 40rpx;

		.icon {
			width: 28rpx;
		}

		text {
			font-size: $font-b;
			color: $black;
		}
	}

	.wxLogin {
		padding: 0 60rpx;
		padding-top: 10vh;

		.h3 {
			font-size: 52rpx;
			font-weight: bold;
			color: #2C2C2C;
		}

		.p {
			font-size: 28rpx;
			color: #82838A;
		}

	}

	.com-btn {
		font-size: 32rpx;
		margin: 0 auto;
		margin-top: 80rpx;
		width: 680rpx;
		border-radius: 10rpx;
	}

	.border {
		border: 1px solid $blue;
		color: $blue;
		background: transparent;
		margin-top: 40rpx;
	}

	.col-red {
		color: #f56c6c;
		text-decoration: underline;
	}

	.licon {
		width: 85rpx;
		margin-bottom: 40rpx;
	}

	.lbox {
		width: 100%;
		padding: 0 60rpx;
		margin-top: 50px;
	}

	.lfont {
		margin-bottom: 30rpx;
		font-size: 48rpx;
		color: #ffffff;
		font-weight: bold;

		.p {
			margin-top: 15rpx;
			font-size: 40rpx;
		}
	}

	.login-box {
		position: relative;
		z-index: 1;
		top: -60rpx;
		background: #fff;
		border-radius: 60rpx 60rpx 0 0;
	}

	/* #ifndef MP-WEIXIN */
	body {
		background-color: #fff;
	}

	page,
	.app {
		background-color: #fff;
	}

	/* #endif */
	/* #ifdef MP-WEIXIN */
	body {
		background-color: #fff;
	}

	page,
	.app {
		background-color: #fff;
	}

	/* #endif */
	.login-state {
		position: fixed;
		width: 100%;
		top: var(--status-bar-height);
		height: 40px;
		line-height: 40px;
		left: 0;
		z-index: 88;
		background: rgba(0, 0, 0, 0);

		.flex {
			justify-content: space-between;
			align-items: center;
		}

		.text {
			font-size: 15px;
			color: #fff;
			padding: 0 20rpx;

		}

		.icons {
			height: 40px;
			line-height: 40px;
			font-size: 0;
			padding: 0 20rpx;
		}

		.icon {
			width: 30rpx;
			height: 30rpx;
			vertical-align: middle;
		}
	}

	.logintop {
		position: relative;
		z-index: 1;

		.bg {
			position: absolute;
			width: 100%;
			display: block;
			top: 0;
			left: 0;
		}
	}

	.navlogin {
		padding: 10upx 0;
		text-align: center;

		.item {
			display: inline-block;
			line-height: 90upx;
			height: 90upx;
			margin: 0 50upx;
			color: #aaa;
			font-size: 18px;
			font-weight: bold;
			position: relative;

			&.active {
				color: #fff;

				text {
					display: block;
				}
			}

			text {
				position: absolute;
				left: 50%;
				bottom: 0;
				width: 14px;
				margin-left: -7px;
				height: 3px;
				background: #333;
				z-index: 12;
				display: none;
			}
		}
	}

	.other {
		padding-top: 40upx;
	}

	.othertip {
		text-align: center;

		.line {
			width: 30px;
			height: 1px;
			display: inline-block;
			vertical-align: middle;
			background: #b9cad7;
		}

		.name {
			vertical-align: middle;
			margin: 0 30upx;
			color: #b9cad7;
			font-size: 13px;
		}
	}

	.other-cont {
		padding: 30upx 0;
		text-align: center;

		.logo {
			width: 90upx;
			height: 90upx;
			border-radius: 50%;
			display: inline-block;
		}
	}

	.login-reg {
		width: 100%;

		.forms {
			width: 100%;
			padding: 30upx 60upx 10upx;
		}

		.form-item {
			position: relative;
			padding: 18upx 0;
			border-bottom: 1px solid #dcdee6;

			.form-txt {
				width: 100%;
				height: 30px;
				line-height: 30px;
				color: #2f3541;
			}

			.pla {
				color: #c3c7d2;
			}

			&.tel {
				padding-left: 60px;

				text {
					position: absolute;
					left: 0;
					top: 20upx;
					height: 20px;
					line-height: 20px;
					transform: translate(0, 5px);
					padding: 0 20upx 0 40upx;
					border-right: 1px solid #ddd;
				}
			}

			&.code {
				padding-right: 30%;

				.btnget {
					height: 30px;
					border-radius: 50px;
					color: $red;
					padding: 0 0.75rem;
					position: absolute;
					right: 0;
					font-size: 13px;
					font-weight: bold;
					top: 0;
					bottom: 0;
					margin: auto;
					border-radius: 20rpx;
					z-index: 8;
					border: 1px solid $red;

					&.active {
						color: #9a9da7;
						border-color: #ccd0db;
					}
				}
			}
		}

		.btn-look {
			position: absolute;
			right: 0;
			transform: translate(0, -50%);
			top: 50%;
			padding: 5px;

			.icon {
				width: 40rpx;
				height: 36rpx;
				display: block;
			}
		}

		.forget {
			text-align: center;
			margin: 20rpx 0;
			font-size: 28rpx;
			color: #b9cad7;

			text {
				display: inline-block;
				padding: 10rpx 30rpx;
			}
		}

		.mobile-login {
			margin: 20rpx 0;
			font-size: 28rpx;
			background: transparent;
			color: #fff;

			&::after {
				display: none !important;
			}
		}

		.create {
			text-align: center;

			text {
				color: #333;
				border-bottom: 1px solid #333;
			}
		}

		.arg {
			padding: 10upx 0;
			font-size: 13px;

			.icon {
				width: 15px;
				height: 15px;
				vertical-align: middle;
				margin-right: 10upx;
			}

			text {
				vertical-align: middle;
			}
		}
	}

	.btnbox {
		padding: 0;
		margin: 40rpx auto 0;
		.btn-sub {
			font-size: 32rpx;
			color: #fff;
			font-weight: bold;
			box-shadow: 0 10rpx 30rpx rgba(77, 106, 183, .4);
			border-radius: 8rpx;
			height: 90rpx;
			line-height: 90rpx;

			&.border {
				color: #4d546c;
				background: #fff;
				border: 1px solid #7d7d89;
				box-shadow: none;
				font-weight: normal;
			}
		}
	}

	.foot {
		font-size: 12px;
		color: #7d7d89;
		vertical-align: top;
		display: inline-block;
		width: calc(100% - 56rpx);
		line-height: 20px;
	}

	.xyicon {
		width: 28rpx;
		margin-right: 10rpx;
		vertical-align: top;
		margin-top: 4rpx;
	}
</style>